<?php

/**
 * Created by PhpStorm.
 * User: WhiteBlue
 * Date: 15/3/2
 * Time: 下午3:26
 */
class loader
{
    private static $loaded = array();

    public static function load($object)
    {
        $valid = array(
            "view",
            "model",
            "router",
            "config");
        if (!in_array($object, $valid)) {
            throw new Exception("未找到对象:'{$object}' ");
        }
        if (empty(self::$loaded[$object])) {
            self::$loaded[$object] = new $object();
        }
        return self::$loaded[$object];
    }
}